
from Agent.blockShortestMove.blockShortest import *
from Agent.Astar.Astar_Home import *
from Config import *

class getActionAgent4:

    def __init__(self,env,player):
        self.env = env
        self.player = player

        if player == 1:
            self.nowstate = env.play1state
            self.playbase = env.play1base
        if player == 2:
            self.nowstate = env.play2state
            self.playbase = env.play2base

    def action(self):
        if self.env.play1capacity == Config.CAPACITYLIMIT:
            aStar = AStar(startpoint=self.nowstate, endpoint=self.playbase, env=self.env, player=1)
            actionNow, lengthNow = aStar.action()
            return actionNow
        else:
            return blockValue(self.env, self.player)
